import time
import hashlib

def custom():
    base_signal = 'hello word'
    timestamp = int(time.time())
    _token = '%s%d'%(base_signal, timestamp)
    a_token = hashlib.sha1(_token.encode('utf-8')).hexdigest()
    return a_token,timestamp

def server(a_token,timestamp) :
    #time.sleep(1)
    base_signal = 'hello word'
    _token = '%s%d'%(base_signal, int(time.time()))
    s_token = hashlib.sha1(_token.encode('utf-8')).hexdigest()
    print(a_token)
    print(s_token)
    if a_token == s_token :
        print('验证成功')
    else :
        print('验证失败')


if __name__ == "__main__" :
    print(custom())
    a_tken,timestamp = custom()
    server(a_tken,timestamp)